export default {
	onShareAppMessage({from}){
		let title=''
		let path=''
		let imageUrl=''
		console.log(from,this.topShareInfo)
		if(from==='button'){
			let info=this.shareMixinInfo
			title=info.share_title
			path=info.path
			imageUrl=info.share_img
			console.log('分享参数','path:',path,'title:',title,'img:',imageUrl)
			this.$emit('btnShare',this.shareMixinInfo)
		}else if(this.topShareInfo){
			title=this.topShareInfo.share_title
			path=this.topShareInfo.path
			let referCode=this.$store.getters.userInfo.refer_code
			if(path&&referCode){
				let hasQuery=path.indexOf('?')!==-1
				path+=(hasQuery?'&':'?')+'refer_code='+referCode
			}
			imageUrl=this.topShareInfo.share_img
		}
		this.onWxShare(from,{title,path,imageUrl})
		return{
			title,
			path,
			imageUrl
		}
	},
	data(){
		return{
			shareMixinInfo:{}
		}
	},
	methods:{
		initShareInfo(data){
			this.shareMixinInfo=data
		},
		onWxShare(){
			
		}
	}
}